package cn.itsource.pojo.domain;

import cn.itsource.constants.RConst;
import lombok.Data;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

@Data
public class Drcard {
    //颁发时间
    private String drcardIssueDate;
    //驾驶证类型
    private String carClass;
    //驾驶证过期时间
    private String drcardExpire;
    //驾驶证正面:云地址
    private String drcardFront;
    //驾驶证背面:云地址
    private String drcardBack;
    //手持驾驶证:云地址
    private String drcardHolding;

    public static Date getDrcardExpire(String drcardExpire){
        SimpleDateFormat dateFormat = new SimpleDateFormat(RConst.DataFormat.YYYY_MM_DD);
        try {
            Date parsed = dateFormat.parse(drcardExpire);
            return parsed;
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
    }

    public static Date getDrcardIssueDate(String drcardIssueDate){
        SimpleDateFormat dateFormat = new SimpleDateFormat(RConst.DataFormat.YYYY_MM_DD);
        try {
            Date parsed = dateFormat.parse(drcardIssueDate);
            return parsed;
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
    }
}
